//仓库的代码 实例化        添加中间件的Api
import { createStore, applyMiddleware } from 'redux'
//导入中间件(异步需要的)
import thunk from 'redux-thunk'
//导入激活chrome插件的第三方模块
import { composeWithDevTools } from 'redux-devtools-extension'
//导入reducer
import reducer from './readucer'
import { getToken } from '@/utils'
//实例化仓库
/* 
参数1  顶级的readucer
参数2  各个reducer的默认值,key是reducer的值,比如这里的login
参数3  中间件(异步)
*/
const store = createStore(
  reducer,
  { login: getToken() },
  composeWithDevTools(applyMiddleware(thunk))
)

export default store
